home *** CD-ROM | disk | FTP | other *** search
/ Amiga Game-Power / Amiga Game-Power.iso / anwendungen / gw print / structurebrowser_v1.3 / sources / sblayer.c < prev    next >
C/C++ Source or Header  |  1994-05-20  |  11KB  |  365 lines

  1. /*
  2.    Handles Layer, Rectangle, Region, RegionRectangle and ClipRect
  3.    structures; LayerInfo structure will be implemented here
  4.  
  5.       Not implemented:
  6.          Layer.LayerInfo
  7.          Layer.Lock
  8. */
  9.  
  10. #include "header/sb.h"
  11. #include <graphics/regions.h>
  12.  
  13. extern int level;         /* recursion level */
  14.  
  15.  
  16. /* PrLayer
  17.  
  18.    Put up the first page of data for a Layer structure.
  19. */
  20.  
  21. PrLayer (string, layer)
  22. char *string;
  23. register struct Layer *layer;
  24. {
  25. static struct StructData structdata[] = {
  26.    { " front",          "struct Layer *",       PRPTR,   PTRSIZE      },
  27.    { " back",           "struct Layer *",       PRPTR,   PTRSIZE      },
  28.    { " ClipRect",       "struct ClipRect *",    PRPTR,   PTRSIZE      },
  29.    { " rp",             "struct RastPort *",    PRPTR,   PTRSIZE      },
  30.    { " bounds",         "struct Rectangle",     PRNULL,  SZ(Rectangle)},
  31.    { " reserved[4]",    "UBYTE",                PRNULL,  BYTESIZE * 4 },
  32.    { "-priority",       "UWORD",                PRUINT,  INTSIZE      },
  33.    { "-Flags",          "UWORD",                PRUINT,  INTSIZE      },
  34.    { " SuperBitMap",    "struct BitMap *",      PRPTR,   PTRSIZE      },
  35.    { " SuperClipRect",  "struct ClipRect *",    PRPTR,   PTRSIZE      },
  36.    { " Window",         "APTR",                 PRPTR,   PTRSIZE      },
  37.    { "-Scroll_X",       "SHORT",                PRINT,   INTSIZE      },
  38.    { "-Scroll_Y",       "SHORT",                PRINT,   INTSIZE      },
  39.    { " cr",             "struct ClipRect *",    PRPTR,   PTRSIZE      },
  40.    { " cr2",            "struct ClipRect *",    PRPTR,   PTRSIZE      },
  41.    { " crnew",          "struct ClipRect *",    PRPTR,   PTRSIZE      },
  42. };
  43.  
  44. int i, sum;
  45. int choice = -1;
  46.  
  47.    level++;
  48.  
  49.    while (choice)
  50.    {
  51.       sum = SetOptionText(string, structdata, (APTR)layer, DATASIZE, 0);
  52.  
  53.       switch (choice = GetChoice(MAXGADG + 1))
  54.       {
  55.          case 1:
  56.             if (layer->front)
  57.                PrLayer("The Layer in front",
  58.                   layer->front);
  59.             break;
  60.          case 2:
  61.             if (layer->back)
  62.                PrLayer("The Layer behind",
  63.                   layer->back);
  64.             break;
  65.          case 3:
  66.             if (layer->ClipRect)
  67.                PrClipRect("The ClipRect for this Layer", layer->ClipRect);
  68.             break;
  69.          case 4:
  70.             if (layer->rp)
  71.                PrRastPort("The RastPort for this Layer",
  72.                   layer->rp);
  73.             break;
  74.          case 5:
  75.             PrRectangle("The bounds of this Layer", &layer->bounds);
  76.             break;
  77.          case 6:
  78.             HexDump("Hexdump of this Layer's reserved bytes (group 1)",
  79.                &layer->reserved[0], BYTESIZE, (long)BYTESIZE * 4);
  80.             break;
  81.          case 9:
  82.             if (layer->SuperBitMap)
  83.                PrBitMap("The SuperBitMap for this Layer",
  84.                      layer->SuperBitMap);
  85.             break;
  86.          case 10:
  87.             if (layer->SuperClipRect)
  88.                PrClipRect("The SuperClipRect for this Layer",
  89.                      layer->SuperClipRect);
  90.             break;
  91.          case 11:
  92.             if (layer->Window)
  93.                PrWindow("The Window corresponding to this Layer",
  94.                   layer->Window);
  95.             break;
  96.          case 14:
  97.             if (layer->cr)
  98.                PrClipRect("The ClipRect known as \"cr\"", layer->cr);
  99.             break;
  100.          case 15:
  101.             if (layer->cr2)
  102.                PrClipRect("The ClipRect known as \"cr2\"", layer->cr2);
  103.             break;
  104.          case 16:
  105.             if (layer->crnew)
  106.                PrClipRect("The ClipRect known as \"crnew\"", layer->crnew);
  107.             break;
  108.          case MOREGADG:
  109.             PrLayer2("Layer members (page 2)", layer, sum);
  110.             break;
  111.       }
  112.    }
  113.    level--;
  114. }
  115.  
  116.  
  117. /* PrLayer2
  118.  
  119.    Put up the second page of data for a Layer structure.
  120. */
  121.  
  122. PrLayer2 (string, layer, offset)
  123. char *string;
  124. struct Layer *layer;
  125. int offset;
  126. {
  127. static struct StructData structdata[] = {
  128.    { " SuperSaveCl...","struct ClipRect *",      PRPTR, PTRSIZE            },
  129.    { " _cliprects",    "struct ClipRect *",      PRPTR, PTRSIZE            },
  130.    { "(LayerInfo",     "struct Layer_Info *)",   PRPTR, PTRSIZE            },
  131.    { "(Lock",          "struct SignalSemaphore)",PRPTR, SZ(SignalSemaphore)},
  132.    { " reserved3[8]",  "UBYTE",                  PRNULL,BYTESIZE * 8       },
  133.    { " ClipRegion",    "struct Region *",        PRPTR, PTRSIZE            },
  134.    { " saveClipRects", "struct Region *",        PRPTR, PTRSIZE            },
  135.    { " reserved2[22]", "UBYTE",                  PRNULL,BYTESIZE * 22      },
  136.    { " DamageList",    "struct Region *",        PRPTR, PTRSIZE            }
  137. };
  138.  
  139. int i, sum;
  140. int choice = -1;
  141.  
  142.    level++;
  143.  
  144.    while (choice)
  145.    {
  146.       sum = SetOptionText(string, structdata, (APTR)layer, DATASIZE, offset);
  147.  
  148.       switch (choice = GetChoice(DATASIZE))
  149.       {
  150.          case 1:
  151.             if (layer->SuperSaveClipRects)
  152.                PrClipRect("This Layer's SuperSaveClipRects",
  153.                      layer->SuperSaveClipRects);
  154.             break;
  155.          case 2:
  156.             if (layer->_cliprects)
  157.                PrClipRect("This Layer's _cliprects", layer->_cliprects);
  158.             break;
  159.          case 5:
  160.             HexDump("Hexdump of this Layer's reserved bytes (group 3)",
  161.                &layer->reserved3[0], BYTESIZE, (long)BYTESIZE * 8);
  162.             break;
  163.          case 6:
  164.             if (layer->ClipRegion)
  165.                PrRegion("This Layer's ClipRegion", layer->ClipRegion);
  166.             break;
  167.          case 7:
  168.             if (layer->saveClipRects)
  169.                PrRegion("This Layer's saveClipRects", layer->saveClipRects);
  170.             break;
  171.          case 8:
  172.             HexDump("Hexdump of this Layer's reserved bytes (group 2)",
  173.                &layer->reserved2[0], BYTESIZE, (long)BYTESIZE * 22);
  174.             break;
  175.          case 9:
  176.             if (layer->DamageList)
  177.                PrRegion("This Layer's DamageList", layer->DamageList);
  178.             break;
  179.       }
  180.    }
  181.    level--;
  182. }
  183.  
  184.  
  185. /* PrRectangle
  186.  
  187.    Put up the data for a Rectangle structure.
  188. */
  189.  
  190. PrRectangle (string, rectangle)
  191. char *string;
  192. struct Rectangle *rectangle;
  193. {
  194. static struct StructData structdata[] = {
  195.    { "-MinX",         "SHORT",               PRINT,      INTSIZE },
  196.    { "-MinY",         "SHORT",               PRINT,      INTSIZE },
  197.    { "-MaxX",         "SHORT",               PRINT,      INTSIZE },
  198.    { "-MaxY",         "SHORT",               PRINT,      INTSIZE }
  199. };
  200.  
  201. int sum;
  202. int choice = -1;
  203.  
  204.    level++;
  205.  
  206.    while (choice)
  207.    {
  208.       sum = SetOptionText(string, structdata, (APTR)rectangle, DATASIZE, 0);
  209.  
  210.       choice = GetChoice(DATASIZE);
  211.    }
  212.    level--;
  213. }
  214.  
  215.  
  216. /* PrRegion
  217.  
  218.    Put up the data for a Region structure.
  219. */
  220.  
  221. PrRegion (string, region)
  222. char *string;
  223. struct Region *region;
  224. {
  225. static struct StructData structdata[] = {
  226.    { " bounds",         "struct Rectangle",    PRNULL,     SZ(Rectangle) },
  227.    { " RegionRecta...", "struct RegionRectangle *",PRPTR,  PTRSIZE }
  228. };
  229.  
  230. int i, sum;
  231. int choice = -1;
  232.  
  233.    level++;
  234.  
  235.    while (choice)
  236.    {
  237.       sum = SetOptionText(string, structdata, (APTR)region, DATASIZE, 0);
  238.  
  239.       switch (choice = GetChoice(DATASIZE))
  240.       {
  241.          case 1:
  242.             PrRectangle("The bounds of this Region", ®ion->bounds);
  243.             break;
  244.          case 2:
  245.             if (region->RegionRectangle)
  246.                PrRegionRect("The RegionRectangle for this Region",
  247.                      region->RegionRectangle);
  248.             break;
  249.       }
  250.    }
  251.    level--;
  252. }
  253.  
  254.  
  255.  
  256. /* PrRegionRect
  257.  
  258.    Put up the data for a RegionRectangle structure.
  259. */
  260.  
  261. PrRegionRect (string, regionrect)
  262. char *string;
  263. struct RegionRectangle *regionrect;
  264. {
  265. static struct StructData structdata[] = {
  266.    { " Next...",     "struct RegionRectangle *",PRPTR,  PTRSIZE },
  267.    { " Prev...",     "struct RegionRectangle *",PRPTR,  PTRSIZE },
  268.    { " bounds",      "struct Rectangle",        PRNULL,     SZ(Rectangle) }
  269. };
  270.  
  271. int i, sum;
  272. int choice = -1;
  273.  
  274.    level++;
  275.  
  276.    while (choice)
  277.    {
  278.       sum = SetOptionText(string, structdata, (APTR)regionrect, DATASIZE, 0);
  279.  
  280.       switch (choice = GetChoice(DATASIZE))
  281.       {
  282.          case 1:
  283.             if (regionrect->Next)
  284.                PrRegionRect("The next RegionRectangle", regionrect->Next);
  285.             break;
  286.          case 2:
  287.             if (regionrect->Prev)
  288.                PrRegionRect("The previous RegionRectangle",
  289.                      regionrect->Prev);
  290.             break;
  291.          case 3:
  292.             PrRectangle("The bounds of this RegionRectangle",
  293.                   ®ionrect->bounds);
  294.             break;
  295.       }
  296.    }
  297.    level--;
  298. }
  299.  
  300.  
  301. /* PrClipRect
  302.  
  303.    Put up the data for a ClipRect structure.
  304. */
  305.  
  306. PrClipRect (string, cliprect)
  307. char *string;
  308. struct ClipRect *cliprect;
  309. {
  310. static struct StructData structdata[] = {
  311.    { " Next",           "struct ClipRect *",       PRPTR,   PTRSIZE       },
  312.    { " prev",           "struct ClipRect *",       PRPTR,   PTRSIZE       },
  313.    { " lobs",           "struct Layer *",          PRPTR,   PTRSIZE       },
  314.    { " BitMap",         "struct BitMap *",         PRPTR,   PTRSIZE       },
  315.    { " bounds",         "struct Rectangle",        PRNULL,  SZ(Rectangle) },
  316.    { " _p1",            "struct ClipRect *",       PRPTR,   PTRSIZE       },
  317.    { " _p2",            "struct ClipRect *",       PRPTR,   PTRSIZE       },
  318.    { "-reserved",       "LONG",                    PRLONG,  PTRSIZE       },
  319. };
  320.  
  321. int i, sum;
  322. int choice = -1;
  323.  
  324.    level++;
  325.  
  326.    while (choice)
  327.    {
  328.       sum = SetOptionText(string, structdata, (APTR)cliprect, DATASIZE, 0);
  329.  
  330.       switch (choice = GetChoice(DATASIZE))
  331.       {
  332.          case 1:
  333.             if (cliprect->Next)
  334.                PrClipRect("The next ClipRect", cliprect->Next);
  335.             break;
  336.          case 2:
  337.             if (cliprect->prev)
  338.                PrClipRect("The previous ClipRect", cliprect->prev);
  339.             break;
  340.          case 3:
  341.             if (cliprect->lobs)
  342.                PrLayer("The Layer for this ClipRect", cliprect->lobs);
  343.             break;
  344.          case 4:
  345.             if (cliprect->BitMap)
  346.                PrBitMap("The BitMap for this ClipRect", cliprect->BitMap);
  347.             break;
  348.          case 5:
  349.             PrRectangle("The bounds of this ClipRect", &cliprect->bounds);
  350.             break;
  351.          case 6:
  352.             if (cliprect->_p1)
  353.                PrClipRect("The ClipRect known as \"_p1\"", cliprect->_p1);
  354.             break;
  355.          case 7:
  356.             if (cliprect->_p2)
  357.                PrClipRect("The ClipRect known as \"_p2\"", cliprect->_p2);
  358.             break;
  359.       }
  360.    }
  361.    level--;
  362. }
  363.  
  364.  
  365.